import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';

@Entity('user')
export class User {
    @PrimaryGeneratedColumn()
    user_id: number;

    @Column({ name: 'username', type: 'varchar', length: 50, unique: true })
    username: string;

    @Column({ name: 'password', type: 'varchar', length: 100 })
    password: string;

    @Column({ name: 'role', type: 'varchar', length: 20, default: 'student' })
    role: string;

    @Column({ name: 'sno', type: 'char', length: 5, nullable: true })
    sno: string;

    @Column({ 
      name: 'tno', 
      type: 'integer', 
      nullable: true 
    })
    tno: number;  // 恢复为数字类型

    @Column({ name: 'create_time', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
    create_time: Date;
}